home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Camelot / Camelot 030 (1988-11)(Swedish User Group of Amiga)(SE)(PD)[WB].zip / Camelot 030 (1988-11)(Swedish User Group of Amiga)(SE)(PD)[WB].adf / PathDev / DOS.H < prev    next >
C/C++ Source or Header  |  1988-10-25  |  3KB  |  137 lines

  1.  
  2. /*
  3.  *  DOS.H
  4.  */
  5.  
  6. #ifdef NOTDEF
  7. #include "exec/types.h"
  8. #include "exec/memory.h"
  9. #include "libraries/dos.h"
  10. #include "libraries/dosextens.h"
  11. #include "libraries/filehandler.h"
  12. #endif NOTDEF
  13.  
  14. /*
  15.  *  ACTIONS which do not exist in dosextens.h but which indeed exist on
  16.  *  the Amiga.
  17.  */
  18.  
  19. #define ACTION_OPENRW        1004
  20. #define ACTION_OPENOLD        1005
  21. #define ACTION_OPENNEW        1006
  22. #define ACTION_CLOSE        1007
  23. #define ACTION_SEEK        1008
  24. #define ACTION_RAWMODE        994
  25. #define ACTION_MORECACHE    18
  26. #define ACTION_FLUSH        27
  27.  
  28. #define CTOB(x) (void *)(((long)(x))>>2)    /*    BCPL conversion */
  29. #define BTOC(x) (void *)(((long)(x))<<2)
  30.  
  31. #define bmov(ss,dd,nn) CopyMem(ss,dd,nn)    /*    my habit    */
  32.  
  33. #define DOS_FALSE   0
  34. #define DOS_TRUE    -1
  35.  
  36. #define RAMFILE     struct _RAMFILE        /*    less restrictive typedefs   */
  37. #define FENTRY        struct _FENTRY
  38. #define LOCKLINK    struct _LL
  39. #define MYFH        struct _MYFH
  40.  
  41. typedef unsigned char    ubyte;            /*    unsigned quantities        */
  42. typedef unsigned short    uword;
  43. typedef unsigned long    ulong;
  44.  
  45. typedef struct Interrupt    INTERRUPT;
  46. typedef struct Task        TASK;
  47. typedef struct FileLock     LOCK;        /*    See LOCKLINK    */
  48. typedef struct FileInfoBlock    FIB;
  49. typedef struct DosPacket    PACKET;
  50. typedef struct Process        PROC;
  51. typedef struct DeviceNode    DEVNODE;
  52. typedef struct DeviceList    DEVLIST;
  53. typedef struct DosInfo        DOSINFO;
  54. typedef struct RootNode     ROOTNODE;
  55. typedef struct FileHandle    FH;
  56. typedef struct MsgPort        PORT;
  57. typedef struct Message        MSG;
  58. typedef struct MinList        LIST;
  59. typedef struct MinNode        NODE;
  60. typedef struct DateStamp    STAMP;
  61. typedef struct InfoData     INFODATA;
  62. typedef struct DosLibrary    DOSLIB;
  63.  
  64. #define FILE_DIR    1
  65. #define FILE_FILE   -1
  66.  
  67.  
  68. RAMFILE {
  69.     NODE    node;
  70.     RAMFILE *parent;
  71.     char    *name;
  72.     char    *comment;
  73.     short   flags;
  74.     short   type;    /*  -1 = file,    1 = dir, 0 = dummy entry    */
  75.     short   locks;    /*  <0:exclusive 0:none >0:shared        */
  76.     ulong   protection;
  77.     ulong   bytes;
  78.     LIST    list;    /*  list of FENTRY's or RAMFILE's   */
  79.     STAMP   date;
  80. };
  81.  
  82. FENTRY {
  83.     NODE    node;
  84.     ubyte   *buf;
  85.     ulong   bytes;
  86. };
  87.  
  88. /*
  89.  *  We use this structure to link locks together in a list for internal
  90.  *  usage.  I could have use the link field in the lock structure as a
  91.  *  real linked list, but didn't want to have to sequentially search the
  92.  *  list to remove a node.
  93.  *
  94.  *  NOTE:   You CANNOT simply extend the FileLock (LOCK) structure.  Some
  95.  *  programs assume it is sizeof(LOCK) big and break.  I found this out the
  96.  *  hard way.
  97.  */
  98.  
  99. LOCKLINK {
  100.     NODE    node;
  101.     LOCK    *lock;
  102. };
  103.  
  104. MYFH {
  105.     NODE    node;
  106.     RAMFILE *file;    /*  file header     */
  107.     FENTRY  *fentry;
  108.     long    base;    /*  base of FENTRY    */
  109.     long    offset;    /*  offset into FENTRY    */
  110. };
  111.  
  112. /*
  113.  *  (void *)  in Aztec C means 'pointer to anything'.  I use it
  114.  *  extensively.
  115.  */
  116.  
  117. extern void *AbsExecBase;
  118.  
  119. extern void *AllocMem(), *RemHead(), *CreatePort(), *GetMsg();
  120. extern void *FindTask(), *Open(), *OpenLibrary();
  121.  
  122. extern void   *dosalloc(), *NextNode(), *GetHead();
  123. extern void   freedata(), freeramfile(), ramunlock(), btos(), returnpacket();
  124. extern LOCK *ramlock();
  125. extern RAMFILE *searchpath(), *createramfile(), *getlockfile();
  126.  
  127. extern char *getpathelement();
  128. extern char *typetostr();
  129.  
  130. #define PType (packet->dp_Type)
  131. #define PArg1 (packet->dp_Arg1)
  132. #define PArg2 (packet->dp_Arg2)
  133. #define PArg3 (packet->dp_Arg3)
  134. #define PArg4 (packet->dp_Arg4)
  135. #define PRes1 (packet->dp_Res1)
  136. #define PRes2 (packet->dp_Res2)
  137.